
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.store.*"%>
<%@page import="com.jedi.*"%>
<%@page import="java.util.*"%>
<%@include file="../global_var.jsp"%>
<%@include file="../check_login.jsp"%>
<%@page import="java.text.*"%>
<%

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
PalvMgr palvMgr = new PalvMgr();
List list = null;
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10301";

if (!just_user.hasPower(power_enable_id)) {

	out.println(strNoPowerInfo); 
	return;
}

String year = ParamUtils.getParameter(request,"year","");
String month = ParamUtils.getParameter(request,"month","");
int conid = ParamUtils.getIntParameter(request,"conid",0);
%>
<html>
<head>
    <base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function clk_contract_show(id) {
	right_menu_clk("company_show.jsp?comid=" + id);
}
function clk_chanage(url){
	location.href=url;

}


function clk_palmonthv_show(y,m) {
	right_menu_clk("palmonth_show.jsp?y=" + y+"&m="+m);
}
</script>
</head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td >
		<form name="pageForm" method="get">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			  <td height="100" valign="top" align="center" style="padding-top:12px;padding-bottom:10px;">
				
					<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
			  <tr bgcolor="#EDEDF0">
			    <td height="30" style="padding-left:10px;" colspan="4">

			
	
	核算日期：	
		 <select name="year">
		  <option value="" <%if (year.trim().equals("")){%> selected<%}%>>全部</option>
                    <%
                    int yearNum = Calendar.getInstance().get(Calendar.YEAR)+10;
                    for(int i= yearNum - 11;i <= yearNum;i++) {
                    %>
                    <option value="<%=i%>"<%if (year.trim().equals(i+"")){%> selected<%}%>><%=i%></option>
                    <%}%>
                  </select> 年 &nbsp; 
                  <select name="month">
                  <option value="" <%if (month.trim().equals("")){%> selected<%}%>>全部</option>
                    <option value="1"<%if (month.trim().equals("1")){%> selected<%}%>>1</option>
                    <option value="2"<%if (month.trim().equals("2")){%> selected<%}%>>2</option>
                    <option value="3"<%if (month.trim().equals("3")){%> selected<%}%>>3</option>
                    <option value="4"<%if (month.trim().equals("4")){%> selected<%}%>>4</option>
                    <option value="5"<%if (month.trim().equals("5")){%> selected<%}%>>5</option>
                    <option value="6"<%if (month.trim().equals("6")){%> selected<%}%>>6</option>
                    <option value="7"<%if (month.trim().equals("7")){%> selected<%}%>>7</option>
                    <option value="8"<%if (month.trim().equals("8")){%> selected<%}%>>8</option>
                    <option value="9"<%if (month.trim().equals("9")){%> selected<%}%>>9</option>
                    <option value="10"<%if (month.trim().equals("10")){%> selected<%}%>>10</option>
                    <option value="11"<%if (month.trim().equals("11")){%> selected<%}%>>11</option>
                    <option value="12"<%if (month.trim().equals("12")){%> selected<%}%>>12</option>
                  </select>
                	 &nbsp;月
           &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
				<input type="submit" class="inputButton" value="确定" >
				<input type="hidden" name="conid" value="<%=conid%>" >
				
				    </td>
				  </tr>
				</table>
				 <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
              <tr>
                <td width="50%" >
                  损益分析 -&gt; 
                <%=year%>年<%=month%>月合同工单损益列表
                </td>
                <td width="50%" align="right" style="padding-right:10px;">&nbsp;
                 
                </td>
              </tr>
            </table>
					<table width="98%" border="0" cellpadding="0" cellspacing="1"
					bgcolor="#FFFFFF">
					<tr align="center" bgcolor="#858585">
			
						<td width="10%"  height="24"><font color="#FFFFFF">项目名称</font></td>
						
						<td width="6%" ><font color="#FFFFFF">合同类型</font></td>
						<td width="5%" ><font color="#FFFFFF">是否有收入</font></td>
						<td width="10%"><font color="#FFFFFF">厂商名称</font></td>
						<td width="5%"  height="24"><font color="#FFFFFF">工程师</font></td>
						<td width="10%"><font color="#FFFFFF">备件成本</font></td>
					    <td width="10%"><font color="#FFFFFF">外部人员技术成本</font></td>
					    <td width="10%" ><font color="#FFFFFF">差旅费</font></td>
						 
					</tr>
					
					<%
              String otherSQL = " ";
               	if (conid!=0) otherSQL += " and conid= '" + conid + "'";
        	if (!year.trim().equals("")) otherSQL += " and y= '" + year.trim() + "'";
	           if (!month.trim().equals("")) otherSQL += " and m= '" + month.trim() + "'";
              String orderField = "y desc,m desc ";
              int pageSize = 10;
              int pageno=1;
               String page2=request.getParameter("mgh");
              		if(page2==null||page2==""){
              				pageno=1;
              				}
              			else{
              					pageno=Integer.parseInt(page2);
              				}
              int pageNo = ParamUtils.getIntParameter(request,"page",pageno);
             
             
                	             String pageno1 = String.valueOf(pageNo); 
							session.setAttribute("pageno",pageno1);
              list = palvMgr.get(otherSQL,orderField,pageNo,pageSize);
              int total = palvMgr.getTotal(); 
              boolean b=(total % pageSize ==0);
              int pageCount=b?(total/pageSize):(total/pageSize +1);
              if(pageNo>pageCount){
              	pageNo=pageCount;
              }
              if (list != null && list.size() > 0) {
              	String bgColor[] = {"#EDEDF0","#D7D7DB"};
              	for(int i=0;i<list.size();i++) {
              		Palv item = (Palv)list.get(i);
              	
              %>
					<tr align="center" bgcolor="<%=bgColor[i%2]%>">
					
						<td height="24"><a
							href="analysis_mgt/palv_detail.jsp?taskid=<%=item.getTaskid()%>"><%=item.getPrjname()%></a>
						</td>
						
					
						
						<td><%=item.getContype()%></td>
						
					
						<td ><%=item.getMonthin_name() %></td>
							<td height="24"><%=item.getComname()%></td>
							<td ><%=item.getUser_name() %></td>
						
						<td align="right"><%=FormatNum.formatCurrencycn(item.getSpartfee())%></td>
						<td align="right"><%=FormatNum.formatCurrencycn(item.getOutefee())%></td>
						<td align="right"><%=FormatNum.formatCurrencycn(item.getTripfee())%></td>
						
					</tr>
					<%}%>
				</table>
					<table width="100%" border="0" cellpadding="0" cellspacing="0"
					background="images/page_img/page_bk.gif">
					
					<tr height="32" align="center" valign="bottom">
						<td width="5%"><img src="images/page_img/page_tag_01.gif"> 
					

							</td>
						<td height="35" align="right" style="padding-right:10px;"
							valign="bottom" id="pannelPageInfo">&nbsp;</td>
					</tr>
					
				</table>
				<script language="javascript">
            pannelPageInfo.innerHTML = getPageInfo(<%=total%>,<%=pageSize%>,<%=pageNo%>,5,'images/page_img','pageForm');
            </script> <%}else{%>
			
					<table width="95%" border="0" cellpadding="4" cellspacing="1"
			bgcolor="#FFFFFF">
			<tr>
				<td height="60" align="center">请选择条件查询项目信息!</td>
			</tr>
		</table>
				<%}%>
		</td>
		
	
		</table>
</form>
</td>
</tr>
</table>

</body>
</html>
